package com.power.collect;

import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;

/**
 * @description:
 * @author: jiangnan
 * @time: 2021/6/2 10:24 上午
 */
public class HashTableDemo {
    Hashtable<String, String> hashTable = new Hashtable<String, String>(10);

    public static void main(String[] args) {
   /*     List<Integer> list = new ArrayList<>();
        Iterator iterator = list.listIterator();
        Vector vector = new Vector();
        Iterable iterable ;
        RoleList roleList = new RoleList();

        Set set  = new HashSet();
        for (int i = 0; i < 10; i++) {
            set.add(i);
        }

        Iterator iterator1 = set.iterator();
        while (iterator1.hasNext()){

            System.out.println(iterator1.next());

        }*/
        Map<Integer, Integer> map = new HashMap();
        for (int i = 0; i < 100; i++) {
            map.put(i, i);
        }


        Iterator iterator = map.entrySet().iterator();
        while (iterator.hasNext()) {
            Map.Entry<Integer, Integer> entry = (Map.Entry<Integer, Integer>) iterator.next();

            //System.out.println(entry.getKey() + " ::: " + entry.getValue());
            if (entry.getKey() %2 ==0) {
                iterator.remove();
            }
        }


       map.forEach((key, value) -> {
            System.out.println("key:: " + key + " " + "value:: " + value);
        });
    }
}
